﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace EasyTools.UI
{
    public partial class TopFrm : Form
    {
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern System.IntPtr GetForegroundWindow();
        public TopFrm()
        {
            InitializeComponent();
            TopMost = true;
            SetWindowPos(GetForegroundWindow(), -1, 0, 0, 0, 0, 1 | 2);

            //this.KeyPreview = true;
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
            this.KeyPreview = true;
        }

        private void richTextBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            
        }

        private void richTextBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if(e.Control&&e.Alt && e.KeyCode == Keys.A)
            {
                this.Hide();
                if (this.Parent != null)
                {
                    this.Parent.Hide();
                }
                new CutScreenFrm().ShowDialog();
                if (this.Parent != null)
                {
                    this.Parent.Show();
                }
                this.Show();

            }else if (e.Control && e.KeyCode == Keys.F)
            {
                

            }
        }
    }
}
